package vn.edu.saigontech.ncms.model.studying;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.OptimisticLockType;

import vn.edu.saigontech.ncms.model.BaseEntity;
import vn.edu.saigontech.ncms.model.enumeration.AttendanceStatus;
import vn.edu.saigontech.ncms.model.info.OfferingMember;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true, optimisticLock = OptimisticLockType.VERSION)
@Table(name = "ncms_attendance")
@SuppressWarnings("serial")
public class Attendance extends BaseEntity {
	
	public static final double WEIGHT = 0.1; 
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "offering_member_id", nullable = false)
	private OfferingMember offeringMember;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "date", nullable = false)
	private Date date;
	
	@Enumerated
	@Column(name = "status")
	private AttendanceStatus status;
	
	@Column(name = "comment", length = 4000)
	private String comment;

	public OfferingMember getOfferingMember() {
		return offeringMember;
	}

	public void setOfferingMember(OfferingMember offeringMember) {
		this.offeringMember = offeringMember;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public AttendanceStatus getStatus() {
		return status;
	}

	public void setStatus(AttendanceStatus status) {
		this.status = status;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}
}